<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
		/*构造方法创建*/
			var reg=new RegExp("a","i");
			var str="Abdcf";
			console.log(reg.test(str));
			
		/*字面量创建*/
			reg=/ab/i;
			console.log(reg.test("bacd"));/*有ab才返回true*/
			
		/*[]表示或*/
			reg=/[abc]/i;
			console.log(reg.test("ad"));
			reg=/[A-Z]/i;/*任意大写字母*/
			reg=/[A-z]/i;/*任意大写字母、小写字母*/
			console.log(reg.test("b"));
		/*[^]表示除了*/
			reg=/[^a]/i;
			console.log(reg.test("abc"));/*除去a有字符返回true*/
		</script>
	</head>
	<body>
	</body>
</html>
